//
//  FSCLeftViewNavi.swift
//  FamiliesSchoolConnection
//
//  Created by 花花蔡 on 2016/12/24.
//  Copyright © 2016年 com.HuaHuaCai. All rights reserved.
//

import UIKit

class FSCLeftViewNavi: NSObject {
    
    var btnBlock:(()->())?
    
    func addNavigationInleftView(title:String,VC:UIViewController) -> Void {
        
        guard let image = UIImage(named: "左箭头_1") else {
            return
        }
        
        let blueView = UIView(frame: CGRect(x: 0, y: 0, width: screenWidth, height: 64))
        blueView.backgroundColor = UIColor.colorWithHex(hexColor: 0x009ee7)
        VC.view.addSubview(blueView)
        
        let backBtn = UIButton(type: .custom)
        backBtn.frame = CGRect(x: 8, y: 21, width: 150, height: 44)
        backBtn.setTitle(title, for: .normal)
        backBtn.titleLabel?.font = UIFont.systemFont(ofSize: 18)
        backBtn.setTitleColor(UIColor.white, for: .normal)
        
        backBtn.setImage(image, for: .normal)
        backBtn.contentHorizontalAlignment = .left
        backBtn.contentVerticalAlignment = .center
        backBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 0)
        backBtn.tag = btnBaseTAG + 50
        backBtn.addTarget(self, action: #selector(btnClicked), for: .touchUpInside)
        blueView.addSubview(backBtn)
        
        VC.view.addSubview(blueView)
    }
    
    func btnClicked() -> Void {
        btnBlock?()
    }

    
}
